import { axios } from '@/utils/request'

let uri = process.env.NODE_ENV === 'production' ? '' : '/yb'

const api = {
    typeCreate: uri + '/warning/type/create', //固定资产名称查询
    typeAll: uri + '/warning/type/all',
    typeDelete: uri + '/warning/type/delete',
    getWarningTypeTree: uri + '/warning/type/getWarningTypeTree',
    getWarningTemplate: uri + '/smsTemplate/getWarningTemplate',
    warningRuleCreate: uri + '/warning/rule/create',
    warningRuleAll: uri + '/warning/rule/all', //获取规则列表
    warningRuleQuery: uri + '/warning/rule/query',
    warningRuleUpdate: uri + '/warning/rule/update',
    ruleChangeState: uri + '/warning/rule/changeState',
    summaryStatistics: uri + '/warning/data/summaryStatistics',
    notHandle: uri + '/warning/data/notHandle',
    handleWarning: uri + '/warning/data/handle', // 预警处置
    hasDisposal: uri + '/warning/data/hasDisposal',
    pendingDisposal: uri + '/warning/data/pending',
    warningAudit: uri + '/warning/data/audit',
    disposalRejected: uri + '/warning/data/disposalRejected',
    logPage: uri + '/warning/log/page',
    changeSelect: uri + '',
}
export function changeSelect(params) {
    return axios({
        url: api.changeSelect,
        method: 'get',
        params
    })
}

// logPage
export function logPage(params) {
    return axios({
        url: api.logPage,
        method: 'get',
        params
    })
}

// disposalRejected
export function disposalRejected(params) {
    return axios({
        url: api.disposalRejected,
        method: 'get',
        params
    })
}

// warningAudit
export function warningAudit(data) {
    return axios({
        url: api.warningAudit,
        method: 'post',
        data
    })
}

export function pendingDisposal(params) {
    return axios({
        url: api.pendingDisposal,
        method: 'get',
        params
    })
}

// 已处置
export function hasDisposal(params) {
    return axios({
        url: api.hasDisposal,
        method: 'get',
        params
    })
}

// handleWarning
export function handleWarning(data) {
    return axios({
        url: api.handleWarning,
        method: 'post',
        data
    })
}

// summaryStatistics
export function summaryStatistics(params) {
    return axios({
        url: api.summaryStatistics,
        method: 'get',
        params
    })
}

// notHandle
export function notHandle(params) {
    return axios({
        url: api.notHandle,
        method: 'get',
        params
    })
}

// ruleChangeState
export function ruleChangeState(data) {
    return axios({
        url: api.ruleChangeState,
        method: 'put',
        data
    })
}

// warningRuleUpdate
export function warningRuleUpdate(data) {
    return axios({
        url: api.warningRuleUpdate,
        method: 'put',
        data
    })
}

// warningRuleQuery
export function warningRuleQuery(id, params) {
    return axios({
        url: `${api.warningRuleQuery}/${id}`,
        method: 'get',
        params
    })
}

// warningRuleAll
export function warningRuleAll(params) {
    return axios({
        url: api.warningRuleAll,
        method: 'get',
        params
    })
}

// warningRuleCreate
export function warningRuleCreate(data) {
    return axios({
        url: api.warningRuleCreate,
        method: 'post',
        data
    })
}

export function getWarningTemplate(params) {
    return axios({
        url: api.getWarningTemplate,
        method: 'get',
        params
    })
}

export function getWarningTypeTree(params) {
    return axios({
        url: api.getWarningTypeTree,
        method: 'get',
        params
    })
}

export function typeCreate(data) {
    return axios({
        url: api.typeCreate,
        method: 'post',
        data
    })
}

export function typeAll(params) {
    return axios({
        url: api.typeAll,
        method: 'get',
        params
    })
}

export function typeDelete(id, params = {}) {
    return axios({
        url: `${api.typeDelete}/${id}`,
        method: 'delete',
        params
    })
}